#ifndef __SPRITE_BUTTON_H__
#define __SPRITE_BUTTON_H__

#include "cocos2d.h"

using namespace cocos2d;

#define SB_TOUCH_BEGAN	0
#define SB_TOUCH_ENDED	1

#define SB_IMAGE_NORMAL		0
#define SB_IMAGE_SELECTED	1

typedef void (CCObject::*SEL_SBHandler)(CCObject*, int);

#define sprite_btn_selector(_SELECTOR) (SEL_SBHandler)(&_SELECTOR)

class CSpriteButton : public cocos2d::CCSprite
{
public:
	CSpriteButton(void);
	virtual ~CSpriteButton(void);

	void initWithTexture(const char *pszFilename, int fWidth, int fHeight, CCObject *pTarget, SEL_SBHandler selector);
	void initWithFrame(CCSpriteFrame *fNormal, CCSpriteFrame *fSelected, CCObject *pTarget, SEL_SBHandler selector);
	bool IsTouchInRect(CCTouch *touch);
	void onTouchBeganHandler(void);
	void onTouchEndedHandler(void);
	CCRect rect(void);

protected:
	CCArray * m_pframeList;
	int m_nStatus;
	CCObject* m_pListener;
	SEL_SBHandler m_pfnSelector;
};

#endif  // __SPRITE_BUTTON_H__